package com.bnyy.medicalHousekeeper.fragment;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bnyy.medicalHousekeeper.R;
import com.bnyy.medicalHousekeeper.adapter.ArticleImageAdapter;
import com.bnyy.medicalHousekeeper.base.BaseFragmentImpl;
import com.bnyy.medicalHousekeeper.bean.ArticleDetail;

import butterknife.BindView;

/**
 * Author : 关炳鹏
 * Description :
 * Date : 2023/2/7
 **/
public class ImageArticleFragment extends BaseFragmentImpl {
    @BindView(R.id.recycler_view)
    RecyclerView recyclerView;

    @Override
    public int getLayoutId() {
        return R.layout.fragment_image_article;
    }

    public static ImageArticleFragment getInstance(ArticleDetail articleDetail) {
        ImageArticleFragment fragment = new ImageArticleFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("articleDetail", articleDetail);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        recyclerView.setLayoutManager(new LinearLayoutManager(mContext));

        Bundle bundle = getArguments();
        if (bundle != null) {
            ArticleDetail articleDetail = (ArticleDetail) bundle.getSerializable("articleDetail");

            recyclerView.setAdapter(new ArticleImageAdapter(mContext, articleDetail));
        }
    }
}





























